package com.example.testbank;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Vector;

import android.content.Context;

import com.testbank.practise.DBManager;


enum CATEGORY {
	CAT_ONE,
	CAT_TWO,
	CAT_THREE
}

enum BOOK {
	BOOK_ONE,
	BOOK_TWO,
	BOOK_THREE
}

public class QuestionManager {
	private Vector<QSet> currentQuestionSet;
	private DBManager dbm;
	private Context currentContext;
	
	public QuestionManager(Context context) {
		currentQuestionSet = new Vector<QSet>();
		currentContext = context;
		dbm = new DBManager(context);
		dbm.open();
		for(int i = 0; i < 15; i++) {
			int id = i+1;
			String question = new String("Test Question " + id);
			String option1 = new String("No.1");
			String option2 = new String("No.2");
			String option3 = new String("No.3");
			Vector<String> options = new Vector<String>();
			options.add(option1);
			options.add(option2);
			options.add(option3);
			String feedback = new String("Feedback");
			
			/*Vector<Integer> arrange = new Vector<Integer>();
			arrange.add(1);
			arrange.add(2);
			arrange.add(3);
			 
			QSet qset = new QSet(question, options, arrange, feedback, id);
			currentQuestionSet.add(qset);*/
		
			dbm.insertQSet(question, null, option1, option2, option3, feedback, 1, 1);
		}
		
	}
	
	public void requestCategory(int category) {
		//Get all questions of a certain category and store into currentQuestionSet
		currentQuestionSet = dbm.getNewQBook(category);
	}
	
	public Vector<QSet> getQuestions() {
		return currentQuestionSet;
	}
	
	public String[] getQuestionNames() {
		int size = currentQuestionSet.size();
		String[] names = new String[size];

		for(int i = 0; i < size; i++) {
			names[i] = currentQuestionSet.get(i).getQuestion();
		}
		return names;
	}
	
	public void requestBook() {
		//Get all questions of a certain book and store into currentQuestionSet
	}
	
	public void nextQuestion() {
		//Random the options
		//Display the question
		//Get and store the answer
		//Show feedback depending on category or book
		//Store the options and answer in SQL
	}
}
